package com.easy.controller;

import com.easy.bean.Productimg;
import com.easy.service.IProductimgService;
import com.easy.util.LayData;
import com.easy.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("productimg")
public class ProductimgController {
    
    @Autowired
    IProductimgService productimgService;

    @RequestMapping("list")
    @ResponseBody
    public LayData getList(Page page, String text){
        List<Productimg> list=productimgService.getList(page,text);
        int count=productimgService.getCount(text);
        return new LayData(count,list);
    }
    @RequestMapping("delete")
    @ResponseBody
    public int delete(int id){
        return productimgService.delete(id);
    }

    @RequestMapping("add")
    @ResponseBody
    public int add(Productimg productimg){
        return productimgService.add(productimg);
    }

    @RequestMapping("edit")
    @ResponseBody
    public int edit(Productimg productimg){
        return productimgService.edit(productimg);
    }
}
